.class public Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;
.super Landroid/content/BroadcastReceiver;
.source "MusicControllerReceiver.java"


# static fields
.field public static final CMDNAME:Ljava/lang/String; = "command"

.field public static final CMDNEXT:Ljava/lang/String; = "next"

.field public static final CMDPAUSE:Ljava/lang/String; = "pause"

.field public static final CMDPREVIOUS:Ljava/lang/String; = "previous"

.field public static final CMDSTOP:Ljava/lang/String; = "stop"

.field public static final CMDTOGGLEPAUSE:Ljava/lang/String; = "togglepause"

.field static final META_CHANGED:Ljava/lang/String; = "com.android.music.metachanged"

.field public static final NEXT_ACTION:Ljava/lang/String; = "com.android.music.musicservicecommand.next"

.field public static final PAUSE_ACTION:Ljava/lang/String; = "com.android.music.musicservicecommand.pause"

.field static final PLAYBACK_COMPLETE:Ljava/lang/String; = "com.android.music.playbackcomplete"

.field static final PLAYSTATE_CHANGED:Ljava/lang/String; = "com.android.music.playstatechanged"

.field public static final PREVIOUS_ACTION:Ljava/lang/String; = "com.android.music.musicservicecommand.previous"

.field static final QUEUE_CHANGED:Ljava/lang/String; = "com.android.music.queuechanged"

.field static final QUIT_PLAYBACK:Ljava/lang/String; = "com.android.music.quitplayback"

.field public static final SERVICECMD:Ljava/lang/String; = "com.android.music.musicservicecommand"

.field static final SERVICE_ACTION:Ljava/lang/String; = "com.android.music.MediaPlaybackService"

.field public static final TAG:Ljava/lang/String; = "MyMusic"

.field public static final TOGGLEPAUSE_ACTION:Ljava/lang/String; = "com.android.music.musicservicecommand.togglepause"

.field private static mMusicController:Lcom/zuimeia/ui/musiccontroller/IMusicController;

.field private static mReceiver:Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;

.field private static mRegistered:Z


# direct methods
.method static constructor <clinit>()V
    .registers 1

    .prologue
    .line 34
    const/4 v0, 0x0

    sput-boolean v0, Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;->mRegistered:Z

    return-void
.end method

.method public constructor <init>()V
    .registers 1

    .prologue
    .line 11
    invoke-direct {p0}, Landroid/content/BroadcastReceiver;-><init>()V

    return-void
.end method

.method public static register(Landroid/content/Context;Lcom/zuimeia/ui/musiccontroller/IMusicController;)V
    .registers 5
    .param p0, "context"    # Landroid/content/Context;
    .param p1, "musicController"    # Lcom/zuimeia/ui/musiccontroller/IMusicController;

    .prologue
    .line 39
    const-string v1, "MyMusic"

    const-string v2, "MusicControllerReceiver register"

    invoke-static {v1, v2}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 40
    sget-boolean v1, Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;->mRegistered:Z

    if-nez v1, :cond_61

    .line 41
    sget-object v1, Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;->mReceiver:Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;

    if-nez v1, :cond_16

    .line 42
    new-instance v1, Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;

    invoke-direct {v1}, Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;-><init>()V

    sput-object v1, Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;->mReceiver:Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;

    .line 45
    :cond_16
    sput-object p1, Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;->mMusicController:Lcom/zuimeia/ui/musiccontroller/IMusicController;

    .line 47
    new-instance v0, Landroid/content/IntentFilter;

    invoke-direct {v0}, Landroid/content/IntentFilter;-><init>()V

    .line 49
    .local v0, "commandFilter":Landroid/content/IntentFilter;
    const-string v1, "com.android.music.metachanged"

    invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V

    .line 50
    const-string v1, "com.android.music.queuechanged"

    invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V

    .line 51
    const-string v1, "com.android.music.playbackcomplete"

    invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V

    .line 52
    const-string v1, "com.android.music.playstatechanged"

    invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V

    .line 53
    const-string v1, "com.kugou.android.music.metachanged"

    invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V

    .line 54
    const-string v1, "com.kugou.android.music.queuechanged"

    invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V

    .line 55
    const-string v1, "com.kugou.android.music.playbackcomplete"

    invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V

    .line 56
    const-string v1, "com.kugou.android.music.playstatechanged"

    invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V

    .line 62
    const-string v1, "com.maxmpz.audioplayer.TRACK_CHANGED"

    invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V

    .line 63
    const-string v1, "com.maxmpz.audioplayer.AA_CHANGED"

    invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V

    .line 64
    const-string v1, "com.maxmpz.audioplayer.STATUS_CHANGED"

    invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V

    .line 65
    const-string v1, "com.maxmpz.audioplayer.PLAYING_MODE_CHANGED"

    invoke-virtual {v0, v1}, Landroid/content/IntentFilter;->addAction(Ljava/lang/String;)V

    .line 71
    sget-object v1, Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;->mReceiver:Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;

    invoke-virtual {p0, v1, v0}, Landroid/content/Context;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;

    .line 72
    const/4 v1, 0x1

    sput-boolean v1, Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;->mRegistered:Z

    .line 74
    .end local v0    # "commandFilter":Landroid/content/IntentFilter;
    :cond_61
    return-void
.end method

.method public static unregister(Landroid/content/Context;)V
    .registers 3
    .param p0, "context"    # Landroid/content/Context;

    .prologue
    const/4 v1, 0x0

    .line 77
    sget-boolean v0, Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;->mRegistered:Z

    if-eqz v0, :cond_11

    .line 78
    sget-object v0, Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;->mReceiver:Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;

    invoke-virtual {p0, v0}, Landroid/content/Context;->unregisterReceiver(Landroid/content/BroadcastReceiver;)V

    .line 79
    sput-object v1, Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;->mReceiver:Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;

    .line 80
    sput-object v1, Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;->mMusicController:Lcom/zuimeia/ui/musiccontroller/IMusicController;

    .line 81
    const/4 v0, 0x0

    sput-boolean v0, Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;->mRegistered:Z

    .line 83
    :cond_11
    return-void
.end method


# virtual methods
.method public onReceive(Landroid/content/Context;Landroid/content/Intent;)V
    .registers 9
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "intent"    # Landroid/content/Intent;

    .prologue
    .line 87
    invoke-virtual {p2}, Landroid/content/Intent;->getAction()Ljava/lang/String;

    move-result-object v0

    .line 88
    .local v0, "action":Ljava/lang/String;
    invoke-static {p1}, Lcom/zuimeia/ui/musiccontroller/MusicControlUtils;->getCurMediaPlayerComponentName(Landroid/content/Context;)Landroid/content/ComponentName;

    move-result-object v3

    invoke-virtual {v3}, Landroid/content/ComponentName;->getPackageName()Ljava/lang/String;

    move-result-object v1

    .line 89
    .local v1, "curMediaPlayerPackage":Ljava/lang/String;
    const-string v3, "MyMusic"

    new-instance v4, Ljava/lang/StringBuilder;

    invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V

    const-string v5, "onReceive action:"

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {p2}, Landroid/content/Intent;->getAction()Ljava/lang/String;

    move-result-object v5

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    const-string v5, "\ncurMediaPlayerPackage:"

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-static {v3, v4}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 91
    const-string v3, "com.kugou.android"

    invoke-virtual {v3, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v3

    if-eqz v3, :cond_76

    .line 92
    const-string v3, "com.kugou.android.music.playstatechanged"

    invoke-virtual {v3, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v3

    if-eqz v3, :cond_58

    .line 93
    sget-object v3, Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;->mMusicController:Lcom/zuimeia/ui/musiccontroller/IMusicController;

    if-eqz v3, :cond_57

    .line 94
    sget-object v3, Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;->mMusicController:Lcom/zuimeia/ui/musiccontroller/IMusicController;

    const-string v4, "track"

    invoke-virtual {p2, v4}, Landroid/content/Intent;->getStringExtra(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v4

    const-string v5, "artist"

    invoke-virtual {p2, v5}, Landroid/content/Intent;->getStringExtra(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v5

    invoke-interface {v3, v4, v5}, Lcom/zuimeia/ui/musiccontroller/IMusicController;->onPlayStateChanged(Ljava/lang/String;Ljava/lang/String;)V

    .line 131
    :cond_57
    :goto_57
    return-void

    .line 96
    :cond_58
    const-string v3, "com.kugou.android.music.metachanged"

    invoke-virtual {v3, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v3

    if-eqz v3, :cond_57

    .line 97
    sget-object v3, Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;->mMusicController:Lcom/zuimeia/ui/musiccontroller/IMusicController;

    if-eqz v3, :cond_57

    .line 98
    sget-object v3, Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;->mMusicController:Lcom/zuimeia/ui/musiccontroller/IMusicController;

    const-string v4, "track"

    invoke-virtual {p2, v4}, Landroid/content/Intent;->getStringExtra(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v4

    const-string v5, "artist"

    invoke-virtual {p2, v5}, Landroid/content/Intent;->getStringExtra(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v5

    invoke-interface {v3, v4, v5}, Lcom/zuimeia/ui/musiccontroller/IMusicController;->onMetaChanged(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_57

    .line 101
    :cond_76
    const-string v3, "com.maxmpz.audioplayer"

    invoke-virtual {v3, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v3

    if-eqz v3, :cond_ca

    .line 102
    const-string v3, "com.maxmpz.audioplayer.STATUS_CHANGED"

    invoke-virtual {v3, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v3

    if-eqz v3, :cond_a4

    .line 103
    sget-object v3, Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;->mMusicController:Lcom/zuimeia/ui/musiccontroller/IMusicController;

    if-eqz v3, :cond_57

    .line 104
    const-string v3, "track"

    invoke-virtual {p2, v3}, Landroid/content/Intent;->getBundleExtra(Ljava/lang/String;)Landroid/os/Bundle;

    move-result-object v2

    .line 105
    .local v2, "track":Landroid/os/Bundle;
    if-eqz v2, :cond_57

    .line 106
    sget-object v3, Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;->mMusicController:Lcom/zuimeia/ui/musiccontroller/IMusicController;

    const-string v4, "title"

    invoke-virtual {v2, v4}, Landroid/os/Bundle;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v4

    const-string v5, "artist"

    invoke-virtual {v2, v5}, Landroid/os/Bundle;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v5

    invoke-interface {v3, v4, v5}, Lcom/zuimeia/ui/musiccontroller/IMusicController;->onPlayStateChanged(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_57

    .line 110
    .end local v2    # "track":Landroid/os/Bundle;
    :cond_a4
    const-string v3, "com.maxmpz.audioplayer.TRACK_CHANGED"

    invoke-virtual {v3, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v3

    if-eqz v3, :cond_57

    .line 111
    sget-object v3, Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;->mMusicController:Lcom/zuimeia/ui/musiccontroller/IMusicController;

    if-eqz v3, :cond_57

    .line 112
    const-string v3, "track"

    invoke-virtual {p2, v3}, Landroid/content/Intent;->getBundleExtra(Ljava/lang/String;)Landroid/os/Bundle;

    move-result-object v2

    .line 113
    .restart local v2    # "track":Landroid/os/Bundle;
    if-eqz v2, :cond_57

    .line 114
    sget-object v3, Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;->mMusicController:Lcom/zuimeia/ui/musiccontroller/IMusicController;

    const-string v4, "title"

    invoke-virtual {v2, v4}, Landroid/os/Bundle;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v4

    const-string v5, "artist"

    invoke-virtual {v2, v5}, Landroid/os/Bundle;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v5

    invoke-interface {v3, v4, v5}, Lcom/zuimeia/ui/musiccontroller/IMusicController;->onMetaChanged(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_57

    .line 119
    .end local v2    # "track":Landroid/os/Bundle;
    :cond_ca
    const-string v3, "com.android.music.playstatechanged"

    invoke-virtual {v3, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v3

    if-eqz v3, :cond_e9

    .line 120
    sget-object v3, Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;->mMusicController:Lcom/zuimeia/ui/musiccontroller/IMusicController;

    if-eqz v3, :cond_57

    .line 121
    sget-object v3, Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;->mMusicController:Lcom/zuimeia/ui/musiccontroller/IMusicController;

    const-string v4, "track"

    invoke-virtual {p2, v4}, Landroid/content/Intent;->getStringExtra(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v4

    const-string v5, "artist"

    invoke-virtual {p2, v5}, Landroid/content/Intent;->getStringExtra(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v5

    invoke-interface {v3, v4, v5}, Lcom/zuimeia/ui/musiccontroller/IMusicController;->onPlayStateChanged(Ljava/lang/String;Ljava/lang/String;)V

    goto/16 :goto_57

    .line 124
    :cond_e9
    const-string v3, "com.android.music.metachanged"

    invoke-virtual {v3, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v3

    if-eqz v3, :cond_57

    .line 125
    sget-object v3, Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;->mMusicController:Lcom/zuimeia/ui/musiccontroller/IMusicController;

    if-eqz v3, :cond_57

    .line 126
    sget-object v3, Lcom/zuimeia/ui/musiccontroller/MusicControllerReceiver;->mMusicController:Lcom/zuimeia/ui/musiccontroller/IMusicController;

    const-string v4, "track"

    invoke-virtual {p2, v4}, Landroid/content/Intent;->getStringExtra(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v4

    const-string v5, "artist"

    invoke-virtual {p2, v5}, Landroid/content/Intent;->getStringExtra(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v5

    invoke-interface {v3, v4, v5}, Lcom/zuimeia/ui/musiccontroller/IMusicController;->onMetaChanged(Ljava/lang/String;Ljava/lang/String;)V

    goto/16 :goto_57
.end method
